
$(function () {
    function dl() {
        if($(".username").val()=='' || $(".password").val() == ''){
            alert("用户名或密码不能为空")
        }else{
            $.post("../api/user.json", {
                username: $(".username").val(),
                password: $(".password").val()
            }, function (data) {
                if (data.records.username == $(".username").val() && data.records.password == $(".password").val()) {
                    window.open("index3.html","_self")
                } else {
                    alert("用户名或密码错误！")
                }
            });
        }
    }
    $("input").keydown(function(e){
        if(e.which == 13){
            dl()
        }
    });
});